#pragma once

#include "Player.h"

class CandidateCell {
public:
	int mColor;
	Board* mBoard;
	Cell* mCell;
	Board::State* mState;

	// 比較関数
    static bool cmp(CandidateCell *a, CandidateCell *b) {
        return a->mState->getPoint(a->mColor) > b->mState->getPoint(b->mColor);
    }

public:
	CandidateCell(int color, Board* board, Cell* cell);
	~CandidateCell();
	bool isWideMarginWon(int color);
	string toString();
//	friend bool operator <(const CandidateCell* riLeft, const CandidateCell* riRight); //	friend bool operator <=(const CandidateCell* riLeft, const CandidateCell* riRight); //	friend bool operator >(const CandidateCell* riLeft, const CandidateCell* riRight); //	friend bool operator >=(const CandidateCell* riLeft, const CandidateCell* riRight);
//	friend bool operator ==(const CandidateCell* riLeft, const CandidateCell* riRight);
};
class AlphaBetaPlayer: public Player {
public:

private:

	static const int MAX = 100000000;
	static const int MIN = -MAX;
//    static const int DEPTH = 8;
	static const int DEPTH = 6;
//	static const int DEPTH = 4;

	int mMaxDepth;
protected:

public:
	AlphaBetaPlayer(string name);
	Cell* next();
private:
	inline int search(Board* board, int depth, int alpha, int beta, int myColor, int otherColor, bool pass, Cell*& outCell);
	inline vector<CandidateCell*> findPutableCells(Board* board, int myColor, int otherColor);
	inline void clear(vector<CandidateCell*> cells);
};

